<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
		
			function doPr(){
				window.print();
			}
			//早了
			// var d=new Date();
			// document.querySelector("#timer").innerHTML=d.toLocaleString();
			//document.getElementById("timer").innerHTML=d.toLocaleString();
			function showTime(){
				var d=new Date();
				document.querySelector("#timer").innerHTML=d.toLocaleString();
			}
			window.onload=function(){
				showTime();
			}
			var timer;
			timer=window.setInterval(showTime,1000);
			
			function stopTimer(){
				window.clearInterval(timer);
			}
			function startTimer(){
				timer=window.setInterval(showTime,1000);
			}
		</script>
	</head>
	<body >
		<div id="timer"></div>
		<div>
			sdfsdf 
		</div>
		<input type="button" value="打印" onclick="doPr()"/>
		<input type="button" value="启动时间" onclick="startTimer()"/>
		<input type="button" value="停止时间" onclick="stopTimer()"/>
	</body>
</html>